package com.class05.method_more._03valuetransfer;

/**
 * @ClassDescription:
 * @JdkVersion: 17
 * @Author: yxy
 * @Created: 2024/3/26 11:24
 */
public class ValueTransferTest1 {
    public static void main(String[] args) {
        ValueTransferTest1 vt = new ValueTransferTest1();
//       1.对于基本类型的变量来说：传递值
        int m = 10;
        vt.method1(m);

//       2.对于引用类型的变量来说:传递地址
        Person p = new Person();
        p.age = 10;
        vt.method2(p);

    }

    public void method1(int m) {
        m++;
    }

    public void method2(Person p) {
        p.age++;
        System.out.println("p = " + p.age);
    }
}

class Person {
    int age;
}
